# Contributor: lauren n. liberda <lauren@selfisekai.rocks>
# Maintainer: lauren n. liberda <lauren@selfisekai.rocks>
pkgname=py3-limits
pkgver=3.13.0
pkgrel=1
pkgdesc="Rate limiting using various strategies and storage backends such as redis & memcached"
url="https://github.com/alisaifee/limits"
arch="noarch"
license="MIT"
depends="
	py3-deprecated
	python3
	"
makedepends="py3-setuptools py3-gpep517"
checkdepends="
	py3-flaky
	py3-mongo
	py3-pytest
	py3-pytest-asyncio
	py3-pytest-benchmark
	py3-pytest-cov
	py3-redis
	"
subpackages="$pkgname-pyc"
options="!check" # most tests are integration with db connections, assume all connectors installed
source="
	https://github.com/alisaifee/limits/archive/refs/tags/$pkgver/limits-$pkgver.tar.gz

	our-std-is-good-enough.patch
	"
builddir="$srcdir/limits-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m pytest \
		-m 'not benchmark and not etcd and not integration and not memcached' \
		-k 'not aio and not Storage and not strategy' -v
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

sha512sums="
0a13d08001c2f95e559ac1be35fa8cc178ad2d41bd5bf7b7e85781a428f550c350c21b92942b5b7e45f0f4c0604e96e579c8a26b5e9ca1196e6605608721030a  limits-3.13.0.tar.gz
0364d51f9f879b95c6a4a3c9e9fd3d7d1e15ea214c50ae98cd36826b8c0b2d903cf1128741ac83738e305a207dae8955a0b2c8679484d2d6643e334595bdb1d7  our-std-is-good-enough.patch
"
